package com.hjk.common.model.vo;

import cn.hutool.core.date.DateTime;
import com.hjk.common.constants.DateConstant;
import com.hjk.common.response.enums.ExceptionEnum;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;


/**
 * @date 2019/10/4 0004 -- 20:23
 */
@Data
public class ExceptionResult {

    /**
     * 响应状态码
     */
    private int status;
    /**
     * 响应错误信息
     */
    private String message;
    /**
     * 时间
     */
    private String timestamp;

    public ExceptionResult(ExceptionEnum e){
        this.status = e.getCode();
        this.message = e.getMessage();
        this.timestamp = DateTime.now().toString(DateConstant.NORM_DATETIME_PATTERN);

    }

    public static void main(String[] args) {
        System.out.println(LocalDate.now());
        System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateConstant.NORM_DATETIME_PATTERN)));
    }

}
